import { createStore } from 'vuex';
import createPersistedState from 'vuex-persistedstate';
import userInfo from './modules/userInfo';
import menuList from './modules/menuList';

const store = createStore({
  modules: {
    userInfo: userInfo,
    menuList: menuList
  },
  // 持久化插件
  plugins: [
    createPersistedState({
      storage: window.sessionStorage,
      key: 'store',
      reducer (state) {
        return {...state}
      }
    })
  ]
});

export default store;